package day6;

import java.util.Scanner;

public class visiter {
    public String name;
    public int age;
    public void print(){
        if(age>18){
        System.out.println("Name : " + name + "age:" + age + "价格 :20");
        }
        else {
            System.out.println("Name : " + name + "age:" + age + "价格 :免费");
        }
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true){
        System.out.println("姓名：");
        String name = sc.nextLine();
        if("n".equals(name)){
            break;
        }
        System.out.println("年龄：");
        int age = sc.nextInt();
        visiter v = new visiter();
        v.name=name;
        v.age=age;
        v.print();
        }
    }
}
